package tmproject.hlhj.fhp.tmvote.activitys

import android.support.v7.widget.GridLayoutManager
import kotlinx.android.synthetic.main.aty_vote.*
import kotlinx.android.synthetic.main.recy_layout.*
import tmproject.hlhj.fhp.tmvote.BaseAty
import tmproject.hlhj.fhp.tmvote.R
import tmproject.hlhj.fhp.tmvote.adapters.VoteAdp
import tmproject.hlhj.fhp.tmvote.beans.VoteBean
import tmproject.hlhj.fhp.tmvote.customView.FullyGridLayoutManager
import tmproject.hlhj.fhp.tmvote.module.VoteModule
import tmproject.hlhj.fhp.tmvote.presenters.VotePresenter
import tmproject.hlhj.fhp.tmvote.views.VoteView

/**
 * Created by Never Fear   on 2018\8\6 0006.
Never More....
 */
class VoteAty :BaseAty<VoteView,VotePresenter>(),VoteView {
    private lateinit var voteAdp:VoteAdp
    private val datas=ArrayList<String>()



    override fun createPresenter(): VotePresenter {
        return VotePresenter()
    }

    override fun getContentId(): Int {
        return R.layout.aty_vote
    }


    /*View接口*/
    override fun initView() {
        voteAdp= VoteAdp(datas)

        recyclerview.layoutManager= FullyGridLayoutManager(this,2)
        recyclerview.adapter=voteAdp

        presenter?.getVoteData()
    }

    override fun logicStart() {
    }

    override fun bindView(): VoteView {
        return this
    }

    override fun setListener() {
        btExit.setOnClickListener {
            finish()
        }
    }

    override fun gotVoteData(voteBean: VoteBean) {
        datas.add("111")
        datas.add("111")
        datas.add("111")
        datas.add("111")
        datas.add("111")

        voteAdp.notifyDataSetChanged()
    }
}